package com.hiwhitley.easy.day22;

/**
 * Created by hiwhitley on 2016/10/14.
 */
public class ReverseInteger_7 {
    public static int reverse(int x) {
        long res = 0;
        while (x != 0) {
            res = res * 10 + x % 10;
            x /= 10;
        }
        if (res > Integer.MAX_VALUE || res < Integer.MIN_VALUE)
            return 0;
        return (int) res;
    }

    public static void main(String[] args) {
        System.out.println(reverse(-1056389759));
    }
}
